Computer Lessons for Kids and Small Adults

Lesson 2

The DOS Operating System

I think that people,  who were forced to find their way around computers running the MS-DOS operating system,  are at an advantage because they know what files are and where they live.   Operating environments such as Windows and the MAC try to cover up these details,  making it harder to learn what really is going on.

Picture yourself sitting at a computer with just the DOS prompt on the screen.   The DOS prompt usually looks like this C:> .   Did you know that there is a program running?   Well,  yes there is,  it's the disk operating system,  DOS.   It's busy doing what it does best,  which is waiting for you to tell it what to do.

So you slide up to your trusty input device,  the keyboard,  and you type a word,  say dor and then you press Enter.   Before talking about what happens next,  let's look at what just happened.

Each time you pressed a letter,  it actually did go to the computer,  because it appeared on the output device,  the monitor.   If you follow the wires,  you see that the only way to get to the monitor from the keyboard is through the computer!  

So,  we learned something,  DOS really is running because somehow the action of pressing a certain key on the keyboard input device,  resulted in a letter being printed in the proper location on the screen output device!   That is actually quite a feat,  and computers had been around a long time before a program could do that.   The fact that DOS puts the character whose key was just pressed on the screen is called echoing and it's done only as a convenience to you,  the user.   And they say that DOS is not user friendly!

DOS also knows enough not to try to interpret what you have typed until you press the Enter key,  indicating you are finished.   There is nothing magical about the Enter key,  it is just another key,  but one that the DOS program,  and many other programs,  have been programmed to recognize as "OK,  I'm finished inputting,  you figure out what I input.".

Okay,  so now DOS has three letters in a row,  in computer terms called a string. The DOS program has a list of steps to follow when it receives a string from the keyboard.

Check to see if it is a command you recognize.   If yes,  then do it.  

If not,  then check to see if there is a file in the current directory that ends in .com or .exe or .bat but has the same first part,  such as dor.com or dor.exe or dor.bat.   If there is,  then get a copy of that file from the long term storage device and into the short term storage,  the RAM,  and run the program.

If there is no such file in the current dir,  then look in each directory that DOS has in a list of directories called the Path.   If you can find such a file,  then,  again,  pull it into RAM and run it (called executing the file).

If DOS has taken all of these steps and still can't interpret what you want,  then,  using the monitor output device,  tell the user 'Bad command or file name'.

Just be thankful that the computer wasn't given boots as an output device,  because a kick in the shins would be more appropriate,  after sending the poor thing on such a wild goose chase!

So,  one thing we've learned is that dor is a pretty meaningless word to both DOS and us!   Now try typing dir

Hey,  that's better.   dir is a command that DOS knows,  and it means "list all the files and directories that are in the current directory."

Now,  when you see 'Bad command or file name' after telling DOS to do something,  you don't have to just sit there with this confused look on your face.   On the logical side of your brain you can figure out why you got that ouptut instead of the one you were expecting.   If you had typed the name of a program,  say wp and were expecting to start-up Word Perfect,  but received that friendly 'Bad command or file name' instead.  then you can go over in your head exactly what DOS had tried to do.

First,  it checked to see if wp was a command it recognized - no it wasn't.   Then it looked for wp.com or wp.exe or wp.bat in its current directory,  the directory the operating system was left in.   If it was there,  DOS would have grabbed the file off the hard drive and put a copy in the RAM.   But it wasn't there.   Then DOS looked in all the directories that are listed in its path variable.   You can see what directories it looks in by giving DOS the command path.   [ Giving DOS the command path means typing path at the dos prompt C:> and pressing Enter ].   DOS spits out the list of directories it has been told to look in.   It didn't find such a file there,  so it told you so.

DOS can be a lot of fun to program,  and is actually an excellent place to start real programming.   My daughter started with MicroWorlds Project Builder (Logo) and then we did some DOS programs and now she's writing small C++ programs.  

If there are enough people interested in these Computer Lessons for Kids and Small Adults,  then I'll teach how to do a little DOS programming.

If you have comments,  good or bad,  please email dsleeth@magmacom.com

Lesson 3 - Files,  the overview